<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>par_kinematics: /home/wouter/ros_packages/thp-pj2-08/par_kinematics/src/point.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>

<table border="0">
<tr><td valign="top" style="border-right: 1px solid #333; padding-right: 10px;" >
<p>
Project: <a href="http://ros.org/wiki/par_kinematics">par_kinematics</a>
</p>
<p>
License: BSD
</p>
<p>
Dependencies: 
<ul>
  <li>std_msgs</li>
  <li>roscpp</li>
  <li>par_trajectory_planning</li>
</ul>
</p>
<p>
Used by:
None<br />
</p>
<p>
<a href="../../index.html">All Packages</a>
</p>

</div>
</td><td valign="top" style="padding-left: 10px;" >
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>/home/wouter/ros_packages/thp-pj2-08/par_kinematics/src/point.cpp</h1>  </div>
</div>
<div class="contents">
<a href="point_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;<a class="code" href="point_8h.html">par_kinematics/point.h</a>&gt;</span>
<a name="l00008"></a>00008 
<a name="l00009"></a><a class="code" href="classPoint.html#a4d43f5247afe8c85c6da1aa39dbcc738">00009</a> <a class="code" href="classPoint.html#a4d43f5247afe8c85c6da1aa39dbcc738">Point::Point</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> z) 
<a name="l00010"></a>00010 {
<a name="l00011"></a>00011         <a class="code" href="classPoint.html#a7cb951c76a0c975fa06c5a6d76745156">moveto</a>(x,y,z);
<a name="l00012"></a>00012 }
<a name="l00013"></a>00013 
<a name="l00014"></a><a class="code" href="classPoint.html#a7cb951c76a0c975fa06c5a6d76745156">00014</a> <a class="code" href="classPoint.html">Point</a> <a class="code" href="classPoint.html#a7cb951c76a0c975fa06c5a6d76745156">Point::moveto</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> z) 
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016         this-&gt;x = x;
<a name="l00017"></a>00017         this-&gt;y = y;
<a name="l00018"></a>00018         this-&gt;z = z;
<a name="l00019"></a>00019 
<a name="l00020"></a>00020         <span class="keywordflow">return</span> (*<span class="keyword">this</span>);
<a name="l00021"></a>00021 }
<a name="l00022"></a>00022 
<a name="l00023"></a><a class="code" href="classPoint.html#a7f81eefdcff2ebefa226c57edca516a8">00023</a> <a class="code" href="classPoint.html">Point</a> <a class="code" href="classPoint.html#a7cb951c76a0c975fa06c5a6d76745156">Point::moveto</a>(<a class="code" href="classPoint.html">Point</a> o) 
<a name="l00024"></a>00024 {
<a name="l00025"></a>00025         this-&gt;<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a> = o.<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>;
<a name="l00026"></a>00026         this-&gt;<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a> = o.<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>;
<a name="l00027"></a>00027         this-&gt;<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a> = o.<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>;
<a name="l00028"></a>00028 
<a name="l00029"></a>00029         <span class="keywordflow">return</span> <a class="code" href="classPoint.html#a4d43f5247afe8c85c6da1aa39dbcc738">Point</a>(<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>, <a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>, <a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>);
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classPoint.html#a1ea7f1ae0a256ad408953387b85c9da2">00032</a> <a class="code" href="classPoint.html">Point</a> <a class="code" href="classPoint.html#a1ea7f1ae0a256ad408953387b85c9da2">Point::offset</a>(<a class="code" href="classPoint.html">Point</a> o) 
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034         this-&gt;<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a> += o.<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>;
<a name="l00035"></a>00035         this-&gt;<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a> += o.<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>;
<a name="l00036"></a>00036         this-&gt;<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a> += o.<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>;
<a name="l00037"></a>00037 
<a name="l00038"></a>00038         <span class="keywordflow">return</span> <a class="code" href="classPoint.html#a4d43f5247afe8c85c6da1aa39dbcc738">Point</a>(<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>, <a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>, <a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>);
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="classPoint.html#a29d28e1ccdea068b22f8f0139099ae36">00041</a> <span class="keywordtype">double</span> <a class="code" href="classPoint.html#a29d28e1ccdea068b22f8f0139099ae36">Point::distFrom</a>(<a class="code" href="classPoint.html">Point</a> o) 
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043         <span class="keywordflow">return</span> <a class="code" href="classUtil.html#a8d52322a903b653dc2866a49114c2832" title="Function for calculating distance between 2 3D-points.">Util::dist</a>(this-&gt;<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>, this-&gt;<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>, this-&gt;<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>, o.<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>, o.<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>, o.<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>);
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="classPoint.html#af0c0f20db1616447bc78184ed537ef6e">00046</a> <a class="code" href="classPoint.html#a4d43f5247afe8c85c6da1aa39dbcc738">Point::Point</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a>&amp; p) 
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048         this-&gt;<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a> = p.<a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>;
<a name="l00049"></a>00049         this-&gt;<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a> = p.<a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>;
<a name="l00050"></a>00050         this-&gt;<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a> = p.<a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>;
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="classPoint.html#adb0cd22cfdf1ed24b87c77eebe5cff9e">00053</a> <span class="keywordtype">void</span> <a class="code" href="classPoint.html#adb0cd22cfdf1ed24b87c77eebe5cff9e">Point::rotateY</a>(<span class="keywordtype">double</span> phi) 
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055         <span class="keywordtype">double</span> x2 = <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>*cos(phi) - <a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>*sin(phi);
<a name="l00056"></a>00056         <span class="keywordtype">double</span> z2 = <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>*sin(phi) + <a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a>*cos(phi);
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a> = x2;
<a name="l00059"></a>00059         <a class="code" href="classPoint.html#a05ba3b1dfcb19430582ae953cbbfbded">z</a> = z2;
<a name="l00060"></a>00060 }               
<a name="l00061"></a>00061 
<a name="l00062"></a><a class="code" href="classPoint.html#a51a93e16bc9f3334e3383b638d18c004">00062</a> <span class="keywordtype">void</span> <a class="code" href="classPoint.html#a51a93e16bc9f3334e3383b638d18c004">Point::rotateZ</a>(<span class="keywordtype">double</span> phi) 
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064         <span class="keywordtype">double</span> x2 = <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>*cos(phi) - <a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>*sin(phi);
<a name="l00065"></a>00065         <span class="keywordtype">double</span> y2 = <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a>*sin(phi) + <a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a>*cos(phi);
<a name="l00066"></a>00066 
<a name="l00067"></a>00067         <a class="code" href="classPoint.html#ab99c56589bc8ad5fa5071387110a5bc7">x</a> = x2;
<a name="l00068"></a>00068         <a class="code" href="classPoint.html#afa38be143ae800e6ad69ce8ed4df62d8">y</a> = y2;
<a name="l00069"></a>00069 }
</pre></div></div>
</div>
</td></tr></table>

<hr size="1"><div style="align: right;">
<a href="http://ros.org/wiki/par_kinematics">par_kinematics</a><br />
Author(s): Wouter van Teijlingen</br />
<small>autogenerated on Mon Jun 13 2011 17:06:55</small>
</div>
</body>
</html>
